<?php
    @include_once("conn.php");


     // 一.  接收前端传递的数据 
     $id = $_GET["id"];  //根据字段id,接收前端传递过来的数据
     if(!$id){  //$id == null
         $obj = array();
         $obj["status"] = false;
         $obj["detail"] = "请传入完整参数";
         exit(json_encode($obj));
     }
 
     // 二.  执行语句
     // 查询
     // mysqli_query($conn,sql语句)  执行传入的sql语句 
     // 成功 => 结果对象(指针对象 内部包含遍历的下标),失败 => false
    //  $result =  mysqli_query($conn,"select id,name,class,chinese,math,english from `grade` where id = $id");
     $sql = "select *  from `goodslist` where goodsId = $id";
     $result = mysqli_query($conn,$sql);
     //打印错误
     if (!$result) {
         printf("Error: %s\n", mysqli_error($conn));
         exit();
     }
     // $item = mysqli_fetch_assoc($result);
     $arr = array();
     while($item = mysqli_fetch_assoc($result)){
         $item["goodsId"] = $item["goodsId"]*1;
         $item["goodsName"] = $item["goodsName"];
         $item["bigPicList"] = explode(",",$item["bigPicList"]);
		 //$item["smallPicList"] = explode(",",$item["smallPicList"]);
		 //$item["smallPicList"] = $item["smallPicList"];
         $item["goodsImg"] =  $item["bigPicList"][0];
         $item["goodsPrice"] = $item["goodsPrice"]*1;
 
         array_push($arr,$item);
     }
   

    echo json_encode($arr);




?>
